
/*
* Copyright 2017-2018 pinganfang
* All right reserved.
*
*/
package com.pingan.haofang.searchcloud.metadata.domain;


import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 * 
 * @author huhailiang937
 */
@Entity
@Table(name = "t_metadata")
@EntityListeners({AuditingEntityListener.class})
public class Metadata {

    /**
     * ID
     */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id")
    private Long id;

    /**
     * 索引ID
     */
    @Column(name = "indexId")
    private Long indexId;

    /**
     * 状态 0：正常 1：停用
     */
    @Column(name = "status")
    private Integer status;

    /**
     * 搜索地址
     */
    @Column(name = "host")
    private String host;

    /**
     * 配置名称
     */
    @Column(name = "config_name")
    private String configName;

    /**
     * 配置版本
     */
    @Column(name = "config_version")
    private Integer configVersion;

    /**
     * 分片数量
     */
    @Column(name = "shard_count")
    private Integer shardCount;

    /**
     * 副本数
     */
    @Column(name = "replication_factor")
    private Integer replicationFactor;

    /**
     * 每个节点最大分片数
     */
    @Column(name = "max_shards_per_node")
    private Integer maxShardsPerNode;

    /**
     * 是否自动复制
     */
    @Column(name = "auto_add_replicas")
    private Boolean autoAddReplicas;

    /**
     * 路由方式
     */
    @Column(name = "router_name")
    private String routerName;

    /**
     * 创建人
     */
    @Column(name = "create_by")
    @CreatedBy
    private Long createBy;

    /**
     * 最后修改人
     */
    @Column(name = "update_by")
    @LastModifiedBy
    private Long updateBy;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getIndexId() {
        return indexId;
    }

    public void setIndexId(Long indexId) {
        this.indexId = indexId;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public String getConfigName() {
        return configName;
    }

    public void setConfigName(String configName) {
        this.configName = configName;
    }

    public Integer getConfigVersion() {
        return configVersion;
    }

    public void setConfigVersion(Integer configVersion) {
        this.configVersion = configVersion;
    }

    public Integer getShardCount() {
        return shardCount;
    }

    public void setShardCount(Integer shardCount) {
        this.shardCount = shardCount;
    }

    public Integer getReplicationFactor() {
        return replicationFactor;
    }

    public void setReplicationFactor(Integer replicationFactor) {
        this.replicationFactor = replicationFactor;
    }

    public Integer getMaxShardsPerNode() {
        return maxShardsPerNode;
    }

    public void setMaxShardsPerNode(Integer maxShardsPerNode) {
        this.maxShardsPerNode = maxShardsPerNode;
    }

    public Boolean getAutoAddReplicas() {
        return autoAddReplicas;
    }

    public void setAutoAddReplicas(Boolean autoAddReplicas) {
        this.autoAddReplicas = autoAddReplicas;
    }

    public String getRouterName() {
        return routerName;
    }

    public void setRouterName(String routerName) {
        this.routerName = routerName;
    }

    public Long getCreateBy() {
        return createBy;
    }

    public void setCreateBy(Long createBy) {
        this.createBy = createBy;
    }

    public Long getUpdateBy() {
        return updateBy;
    }

    public void setUpdateBy(Long updateBy) {
        this.updateBy = updateBy;
    }

    @Override
    public String toString() {
        return "Metadata{" +
                "id=" + id +
                ", indexId=" + indexId +
                ", status=" + status +
                ", host='" + host + '\'' +
                ", configName='" + configName + '\'' +
                ", configVersion=" + configVersion +
                ", shardCount=" + shardCount +
                ", replicationFactor=" + replicationFactor +
                ", maxShardsPerNode=" + maxShardsPerNode +
                ", autoAddReplicas=" + autoAddReplicas +
                ", routerName='" + routerName + '\'' +
                ", createBy=" + createBy +
                ", updateBy=" + updateBy +
                '}';
    }
}
